<?php
if (!isset($_COOKIE["user"]))
    return 0;
$replace = array('_');
?>
<div id="sidebar">
    <h3>Navigation</h3>
    <?php
    $db = mysql_connect(db_server, $db_user, $db_password);
    mysql_select_db($db_dbname);
    $result = mysql_query("describe Security");
    while ($row = mysql_fetch_array($result)) {
        if ($row['Field'] != 'RUID') {
            echo '<li><a href="' . strtolower($row['Field']) . '.php?ruid=' . $getRuid . '">' . str_replace($replace, " ", $row['Field']) . '</a></li>';
            echo "\n";
        }
    }
    ?>
    <br>

    <?php
    include('includes/dbInfo.php');

    $db = mysql_connect(db_server, $db_user, $db_password);
    mysql_select_db($db_dbname);

    $result = mysql_query("SELECT id, PageTitle FROM SavedQueries");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        echo "<h3>Saved Queries</h3>";
        while ($row = mysql_fetch_array($result)) {
            echo "<li><a href='querypage.php?id=" . $row['id'] . "'>" . $row['PageTitle'] . "</a></li>\n";
        }
    }
    mysql_close($db)
    ?>
    <br>

</div>
<!-- end #sidebar -->